home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-11-06 | 26.9 KB | 868 lines | [TEXT/CWIE] |
- //
- // GrayCouncil
- // Copyright ©1996 by Trygve Isaacson. All Rights Reserved.
- //
- // This file contains the GrayCouncil MacApp test program's
- // application class implementation.
- //
-
- #include "UMyApplication.h"
-
- #include "MyConstants.h"
-
- //
- // TMyApplication -------------------------------------------------------------------------
- //
-
- #undef Inherited
- #define Inherited TApplication
-
- #pragma segment AMyApplication
- MA_DEFINE_CLASS_M1(TMyApplication, Inherited);
-
- TMyApplication::TMyApplication()
- {
- // Init the pointers & stuff used during idling.
- mProgressIndicator1 = NULL;
- mProgressIndicator2 = NULL;
- mMovingProgressOrigin = false;
- mSkipNext = false;
- }
-
- TMyApplication::~TMyApplication()
- {
- }
-
- void TMyApplication::IMyApplication()
- {
- FailOSErr(InitGrayCouncilMA());
-
- this->IApplication('????', '????');
-
- // Tell MacApp we don't want an Untitled document created at launch.
- fLaunchWithNewDocument = false;
-
- this->SetIdleFreq(2);
-
- // Create our main window.
-
- TWindow* aWindow;
- FailNIL(aWindow = gViewServer->NewTemplateWindow(kMainWindowViewID, NULL));
- aWindow->Open();
-
- // Allow the window to be resized, but no smaller than
- // its initial size.
-
- CRect windowFrame;
- CPoint minWindowSize;
- CPoint maxWindowSize(kMaxCoord, kMaxCoord);
-
- aWindow->GetQDExtent(windowFrame);
- minWindowSize = windowFrame[botRight] - windowFrame[topLeft];
-
- aWindow->SetResizeLimits(minWindowSize, maxWindowSize);
- }
-
- void TMyApplication::DoSetupMenus()
- {
- Inherited::DoSetupMenus();
-
- // Enable all of the Test menu commands.
- for (UInt32 i = 0; i < kNumDialogs; i++)
- Enable(kMyCommandBase + i, true);
- }
-
- void TMyApplication::DoMenuCommand(CommandNumber aCommand)
- {
- // Handle the Test menu commands.
-
- if ((aCommand - kMyCommandBase >= 0) &&
- (aCommand - kMyCommandBase < kNumDialogs))
- this->PoseExampleDialog(aCommand - kMyCommandBase);
- else
- Inherited::DoMenuCommand(aCommand);
- }
-
- void TMyApplication::DoEvent(EventNumber eventNumber, TEventHandler* source, TEvent* event)
- {
- IDType sourceID = source->GetIdentifier();
- UInt32 buttonDialogIndex = sourceID; // main window buttons are ID'd as kMyViewBase + dialogIndex
-
- if ((buttonDialogIndex >= kMyViewBase) && (buttonDialogIndex < (kMyViewBase + kNumDialogs)))
- this->PoseExampleDialog(buttonDialogIndex - kMyViewBase);
- else
- {
- switch (sourceID)
- {
- case 'ENAB':
- {
- // Enable or disable everything in the button's dialog.
-
- TCheckBox* aCheckBox = (TCheckBox*) source;
- TWindow* aWindow = aCheckBox->GetWindow();
-
- this->EnableDisableDialog(mCurrentDialogIndex, aWindow, aCheckBox->IsOn());
- }
- break;
- case 'SBAR':
- {
- // The scroll bar dialog's TScrollBar was hit.
- // Update the text that displays the TScrollBar value.
-
- TScrollBar* aScrollBar = (TScrollBar*) source;
- TWindow* aWindow = aScrollBar->GetWindow();
- TStaticText* valueText = (TStaticText*) aWindow->FindSubView('SBTX');
- SInt32 scrollBarValue = aScrollBar->GetLongVal();
- CStr255 valueString;
-
- ::NumToString(scrollBarValue, valueString);
-
- valueText->SetText(valueString, kRedraw);
- }
- break;
- case 'LIVE':
- case 'PROP':
- {
- // The scroll bar dialog had one of its checkboxes hit.
- // Toggle the appropriate attribute of the 3 scroll bars
- // in the dialog.
-
- AGAScrollerScrollBarMA* aScrollerScrollBar;
- TWindow* aWindow = ((TCheckBox*) source)->GetWindow();
- TCheckBox* liveCheckBox = (TCheckBox*) aWindow->FindSubView('LIVE');
- TCheckBox* propCheckBox = (TCheckBox*) aWindow->FindSubView('PROP');
-
- aScrollerScrollBar = (AGAScrollerScrollBarMA*) aWindow->FindSubView('HSBR');
- aScrollerScrollBar->mAGAObject->SetAttributes(AGAObject::kHorizontal, liveCheckBox->IsOn(), propCheckBox->IsOn());
- aScrollerScrollBar->UpdateScrollAmounts();
-
- if (sourceID == 'PROP')
- aScrollerScrollBar->ForceRedraw();
-
- aScrollerScrollBar = (AGAScrollerScrollBarMA*) aWindow->FindSubView('VSBR');
- aScrollerScrollBar->mAGAObject->SetAttributes(AGAObject::kVertical, liveCheckBox->IsOn(), propCheckBox->IsOn());
- aScrollerScrollBar->UpdateScrollAmounts();
-
- if (sourceID == 'PROP')
- aScrollerScrollBar->ForceRedraw();
-
- AGAScrollBarMA* aScrollBar = (AGAScrollBarMA*) aWindow->FindSubView('SBAR');
- aScrollBar->mAGAObject->SetAttributes(AGAObject::kHorizontal, liveCheckBox->IsOn(), propCheckBox->IsOn());
-
- if (sourceID == 'PROP')
- aScrollBar->ForceRedraw();
- }
- break;
-
- case 'LVSL':
- case 'PRSL':
- {
- // The slider dialog had one of its checkboxes hit.
- // Toggle the appropriate attribute of all sliders
- // in the dialog.
-
- AGASliderMA* aSlider;
- TWindow* aWindow = ((TCheckBox*) source)->GetWindow();
- TCheckBox* liveCheckBox = (TCheckBox*) aWindow->FindSubView('LVSL');
- TCheckBox* propCheckBox = (TCheckBox*) aWindow->FindSubView('PRSL');
-
- aSlider = (AGASliderMA*) aWindow->FindSubView('VSPL');
- aSlider->mAGAObject->SetAttributes(AGAObject::kVertical, liveCheckBox->IsOn(), propCheckBox->IsOn());
- if (sourceID == 'PRSL') aSlider->ForceRedraw();
-
- aSlider = (AGASliderMA*) aWindow->FindSubView('VSPR');
- aSlider->mAGAObject->SetAttributes(AGAObject::kVertical, liveCheckBox->IsOn(), propCheckBox->IsOn());
- if (sourceID == 'PRSL') aSlider->ForceRedraw();
-
- aSlider = (AGASliderMA*) aWindow->FindSubView('VSRC');
- aSlider->mAGAObject->SetAttributes(AGAObject::kVertical, liveCheckBox->IsOn(), propCheckBox->IsOn());
- if (sourceID == 'PRSL') aSlider->ForceRedraw();
-
- aSlider = (AGASliderMA*) aWindow->FindSubView('HSPL');
- aSlider->mAGAObject->SetAttributes(AGAObject::kHorizontal, liveCheckBox->IsOn(), propCheckBox->IsOn());
- if (sourceID == 'PRSL') aSlider->ForceRedraw();
-
- aSlider = (AGASliderMA*) aWindow->FindSubView('HSPR');
- aSlider->mAGAObject->SetAttributes(AGAObject::kHorizontal, liveCheckBox->IsOn(), propCheckBox->IsOn());
- if (sourceID == 'PRSL') aSlider->ForceRedraw();
-
- aSlider = (AGASliderMA*) aWindow->FindSubView('HSRC');
- aSlider->mAGAObject->SetAttributes(AGAObject::kHorizontal, liveCheckBox->IsOn(), propCheckBox->IsOn());
- if (sourceID == 'PRSL') aSlider->ForceRedraw();
- }
- break;
-
- case 'BIGP':
- case 'LILP':
- {
- TPicture* thePicture = (TPicture*) ((TView*) source)->GetWindow()->FindSubView('PICT');
-
- thePicture->SetPictureRsrcID((sourceID == 'BIGP') ? kBigPictureID : kLittlePictureID, kRedraw);
-
- CRect pictFrame = (**(thePicture->fDataHandle)).picFrame;
- VPoint pictSize(pictFrame[botRight] - pictFrame[topLeft]);
-
- thePicture->Resize(pictSize, kInvalidate);
- }
- break;
-
- case 'LRGT':
- case 'SMLT':
- {
- AGATabPanelMA* tabPanel;
- Boolean small = (sourceID == 'SMLT');
-
- tabPanel = (AGATabPanelMA*) ((TView*) source)->GetWindow()->FindSubView('TAB1');
- tabPanel->mAGAObject->SetTabSize(small ? AGATabPanel::kSmallTabs : AGATabPanel::kLargeTabs);
- tabPanel->mAGAObject->SetLabelsStyle(small ? gAGAStdBoldSmallStyle : gAGAStdSystemStyle);
- tabPanel->ForceRedraw();
-
- tabPanel = (AGATabPanelMA*) ((TView*) source)->GetWindow()->FindSubView('TAB2');
- tabPanel->mAGAObject->SetTabSize(small ? AGATabPanel::kSmallTabs : AGATabPanel::kLargeTabs);
- tabPanel->mAGAObject->SetLabelsStyle(small ? gAGAStdBoldSmallStyle : gAGAStdSystemStyle);
- tabPanel->ForceRedraw();
- }
- break;
-
- case 'GO_1':
- {
- // Save the pointer to the indeterminate progress indicator,
- // so we'll increment it at idle. Swap the enable states
- // of its Go and Stop buttons.
-
- TButton* buttonToDisable = (TButton*) source;
- TWindow* aWindow = buttonToDisable->GetWindow();
- TButton* buttonToEnable = (TButton*) aWindow->FindSubView('STP1');
-
- this->ToggleButtons(buttonToDisable, buttonToEnable);
-
- mProgressIndicator1 = (AGAProgressIndicatorMA*) aWindow->FindSubView('PRG1');
-
- mProgressIndicator1->StartAutoAnimate();
- }
- break;
-
- case 'GO_2':
- {
- // Null the pointer to the determinate progress indicator,
- // so we'll ignore it at idle. Swap the enable states
- // of its Go and Stop buttons.
-
- TButton* buttonToDisable = (TButton*) source;
- TWindow* aWindow = buttonToDisable->GetWindow();
- TButton* buttonToEnable = (TButton*) aWindow->FindSubView('STP2');
-
- this->ToggleButtons(buttonToDisable, buttonToEnable);
-
- mProgressIndicator2 = (AGAProgressIndicatorMA*) aWindow->FindSubView('PRG2');
- }
- break;
-
- case 'STP1':
- {
- // Save the pointer to the indeterminate progress indicator,
- // so we'll increment it at idle. Swap the enable states
- // of its Go and Stop buttons.
-
- TButton* buttonToDisable = (TButton*) source;
- TWindow* aWindow = buttonToDisable->GetWindow();
- TButton* buttonToEnable = (TButton*) aWindow->FindSubView('GO_1');
-
- this->ToggleButtons(buttonToDisable, buttonToEnable);
-
- mProgressIndicator1 = (AGAProgressIndicatorMA*) aWindow->FindSubView('PRG1');
-
- mProgressIndicator1->StopAutoAnimate();
-
- mProgressIndicator1 = NULL;
- }
- break;
-
- case 'STP2':
- {
- // Null the pointer to the indeterminate progress indicator,
- // so we'll ignore it at idle. Swap the enable states
- // of its Go and Stop buttons.
-
- TButton* buttonToDisable = (TButton*) source;
- TWindow* aWindow = buttonToDisable->GetWindow();
- TButton* buttonToEnable = (TButton*) aWindow->FindSubView('GO_2');
-
- this->ToggleButtons(buttonToDisable, buttonToEnable);
-
- mProgressIndicator2 = NULL;
- }
- break;
-
- case 'CORG':
- {
- // The progress dialog's "Moving Origin" checkbox was hit.
- // Enable or disable the edit text and little arrows, and
- // set our flag that we'll check at idle.
-
- TCheckBox* aCheckBox = (TCheckBox*) source;
- TWindow* aWindow = aCheckBox->GetWindow();
- Boolean enabled = aCheckBox->IsOn();
- TControl* aControl;
-
- aControl = (TControl*) aWindow->FindSubView('NORG');
- ((TEditText*) aControl)->StopEdit();
- aControl->SetEnable(enabled);
- aControl->DimState(! enabled, kRedraw);
-
- aControl = (TControl*) aWindow->FindSubView('AORG');
- aControl->SetEnable(enabled);
- aControl->DimState(! enabled, kRedraw);
-
- aControl = (TControl*) aWindow->FindSubView('TORG');
- aControl->SetEnable(enabled);
- aControl->DimState(! enabled, kRedraw);
-
- mMovingProgressOrigin = enabled;
- }
- break;
-
- case 'SETV':
- {
- // The "Set Values" button in the progress dialog was hit.
- // Poke the determinate progress indicator with the current
- // values that have been entered in the dialog.
-
- TWindow* aWindow = ((TButton*) source)->GetWindow();
- TNumberText* aNumberText;
- TCheckBox* originCheckBox = (TCheckBox*) aWindow->FindSubView('CORG');
- SInt32 newMin;
- SInt32 newMax;
- SInt32 newValue;
- SInt32 newOrigin;
-
- AGAProgressIndicatorMA* indicator = (AGAProgressIndicatorMA*) aWindow->FindSubView('PRG2');
-
- aNumberText = (TNumberText*) aWindow->FindSubView('NMIN');
- newMin = aNumberText->GetValue();
-
- aNumberText = (TNumberText*) aWindow->FindSubView('NMAX');
- newMax = aNumberText->GetValue();
-
- indicator->mAGAObject->SetRange(newMin, newMax, kDontRedraw);
-
- aNumberText = (TNumberText*) aWindow->FindSubView('NVAL');
- newValue = aNumberText->GetValue();
- indicator->mAGAObject->SetValue(newValue, kDontRedraw);
-
- if (! originCheckBox->IsOn())
- newOrigin = newMin;
- else
- {
- aNumberText = (TNumberText*) aWindow->FindSubView('NORG');
- newOrigin = Max(newMin, aNumberText->GetValue());
- }
-
- indicator->mAGAObject->SetOriginValue(newOrigin, kDontRedraw);
-
- indicator->ForceRedraw();
- }
- break;
-
- case 'EDCB':
- {
- // Enable or disable the first field of the edit text dialog.
-
- TCheckBox* aCheckBox = (TCheckBox*) source;
- TWindow* aWindow = aCheckBox->GetWindow();
- Boolean enabled = aCheckBox->IsOn();
- TEditText* anEditText = (TEditText*) aWindow->FindSubView('EDT1');
-
- anEditText->StopEdit();
- anEditText->SetEnable(enabled);
- anEditText->DimState(! enabled, kRedraw);
- }
- break;
-
- }
- }
-
- Inherited::DoEvent(eventNumber, source, event);
- }
-
- void TMyApplication::ToggleButtons(TButton* buttonToDisable, TButton* buttonToEnable)
- {
- buttonToDisable->SetEnable(false);
- buttonToDisable->DimState(true, kRedraw);
-
- buttonToEnable->SetEnable(true);
- buttonToEnable->DimState(false, kRedraw);
- }
-
- Boolean TMyApplication::DoIdle(IdlePhase /*phase*/)
- {
- // If we have a pointer to the indeterminate progress indicator,
- // crank it once.
- // if (mProgressIndicator1 != NULL)
- // if (mProgressIndicator1->Focus())
- // mProgressIndicator1->mAGAObject->Animate();
-
- // If we have a pointer to the determinate progress indicator,
- // increment its value.
- if (mProgressIndicator2 != NULL)
- if (mProgressIndicator2->Focus())
- {
- mProgressIndicator2->mAGAObject->Increment(1, kRedraw);
-
- // Increment the origin every other time, if it's moving.
- if (mMovingProgressOrigin && ! mSkipNext)
- mProgressIndicator2->mAGAObject->SetOriginValue(1 + mProgressIndicator2->mAGAObject->GetOriginValue(), kRedraw);
-
- mSkipNext = ! mSkipNext; // make moving origin go slower than value
- }
-
- return false; // did not free self
- }
-
- void TMyApplication::PoseExampleDialog(UInt32 dialogIndex)
- {
- // Run the specified dialog.
-
- TWindow *aWindow;
-
- FailNIL(aWindow = gViewServer->NewTemplateWindow(kMyViewBase + dialogIndex, NULL));
-
- mCurrentDialogIndex = dialogIndex;
-
- this->SetupExampleDialog(dialogIndex, aWindow);
-
- (void) aWindow->PoseModally();
-
- this->CleanupExampleDialog(dialogIndex, aWindow);
-
- aWindow->CloseAndFree();
- }
-
- void TMyApplication::SetupExampleDialog(UInt32 dialogIndex, TWindow* itsWindow)
- {
- // Note that when we set AGAObject states & values here, we tell it
- // not to redraw right now, because the dialog isn't visible yet.
- // If we *did* tell it to redraw, we would have to Focus() it first
- // so that the AGAObject would be drawing into the correct GrafPort.
-
- switch (dialogIndex)
- {
- case kCheckBoxDlgIndex:
- {
- AGACheckBoxMA* mixedCheckBox;
- FailNIL(mixedCheckBox = (AGACheckBoxMA*) itsWindow->FindSubView('BTN3'));
- mixedCheckBox->mAGAObject->SetValue(AGACheckBox::kCheckBoxMixed, AGAObject::kDontRedraw);
- }
- break;
- case kRadioButtonDlgIndex:
- {
- AGARadioButtonMA* mixedRadioButton;
- FailNIL(mixedRadioButton = (AGARadioButtonMA*) itsWindow->FindSubView('BTN3'));
- mixedRadioButton->mAGAObject->SetValue(AGARadioButton::kRadioButtonMixed, AGAObject::kDontRedraw);
- }
- break;
- case kScrollBarDlgIndex:
- {
- AGAScrollBarMA *aScrollBar = (AGAScrollBarMA*) itsWindow->FindSubView('SBAR');
- aScrollBar->mAGAObject->SetPageSize(25, AGAObject::kDontRedraw);
- aScrollBar->mAGAObject->SetStepSizes(1, 25);
- }
- break;
- case kSliderDlgIndex:
- {
- AGASliderMA* aSlider;
-
- FailNIL(aSlider = (AGASliderMA*) itsWindow->FindSubView('HSPL'));
- aSlider->mAGAObject->SetRange(0, 100, AGAObject::kDontRedraw);
- aSlider->mAGAObject->SetPageSize(1, AGAObject::kDontRedraw);
-
- FailNIL(aSlider = (AGASliderMA*) itsWindow->FindSubView('VSPR'));
- aSlider->mAGAObject->SetJustification(teFlushRight);
- aSlider->mAGAObject->SetPageSize(1, AGAObject::kDontRedraw);
-
- FailNIL(aSlider = (AGASliderMA*) itsWindow->FindSubView('HSPR'));
- aSlider->mAGAObject->SetJustification(teFlushRight);
- aSlider->mAGAObject->SetRange(0, 32, AGAObject::kDontRedraw);
- aSlider->mAGAObject->SetPageSize(1, AGAObject::kDontRedraw);
-
- FailNIL(aSlider = (AGASliderMA*) itsWindow->FindSubView('VSPL'));
- aSlider->mAGAObject->SetPageSize(1, AGAObject::kDontRedraw);
-
- FailNIL(aSlider = (AGASliderMA*) itsWindow->FindSubView('VSRC'));
- aSlider->mAGAObject->SetRange(0, 100, AGAObject::kDontRedraw);
- aSlider->mAGAObject->SetPageSize(20, AGAObject::kDontRedraw);
-
- FailNIL(aSlider = (AGASliderMA*) itsWindow->FindSubView('HSRC'));
- aSlider->mAGAObject->SetRange(0, 100, AGAObject::kDontRedraw);
- aSlider->mAGAObject->SetPageSize(20, AGAObject::kDontRedraw);
- }
- break;
- case kDisclosureDlgIndex:
- {
- AGADisclosureTriangleMA* aTriangle;
- FailNIL(aTriangle = (AGADisclosureTriangleMA*) itsWindow->FindSubView('DIS3'));
- aTriangle->mAGAObject->SetState(AGADisclosureTriangle::kDisclosedState, AGAObject::kDontRedraw);
- }
- break;
- case kProgressDlgIndex:
- {
- AGAProgressIndicatorMA* aProgressIndicator;
- FailNIL(aProgressIndicator = (AGAProgressIndicatorMA*) itsWindow->FindSubView('PRG1'));
- aProgressIndicator->mAGAObject->SetRange(0, 0, AGAObject::kDontRedraw);
- }
- break;
- case kFolderTabsDlgIndex:
- {
- AGATabPanelMA* tabPanel;
-
- FailNIL(tabPanel = (AGATabPanelMA*) itsWindow->FindSubView('TAB1'));
-
- tabPanel->InstallPanel(0, 3000, NULL);
- tabPanel->InstallPanel(1, 3001, NULL);
- tabPanel->InstallPanel(2, 3002, NULL);
- }
- break;
- }
- }
-
- void TMyApplication::CleanupExampleDialog(UInt32 dialogIndex, TWindow* /*itsWindow*/)
- {
- switch (dialogIndex)
- {
- case kProgressDlgIndex:
- {
- // Null the pointers so we don't go haywire at next DoIdle !
-
- mProgressIndicator1 = NULL;
- mProgressIndicator2 = NULL;
- mMovingProgressOrigin = false;
- mSkipNext = false;
- }
- break;
- }
- }
-
- void TMyApplication::EnableDisableDialog(UInt32 dialogIndex, TWindow* itsWindow, Boolean enable)
- {
- // Find all of the appropriate items of the specified dialog,
- // and set their enable/disable/dim state as requested.
-
- TControl* aControl;
- TView* aView;
-
- switch (dialogIndex)
- {
- case kPushButtonDlgIndex:
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('BTN1'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('BTN2'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('ICN1'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('ICN2'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('ICN3'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- break;
-
- case kCheckBoxDlgIndex:
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('BTN1'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('BTN2'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('BTN3'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('ICN1'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('ICN2'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('ICN3'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- break;
-
- case kRadioButtonDlgIndex:
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('BTN1'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('BTN2'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('BTN3'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('ICN1'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('ICN2'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('ICN3'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('ICN4'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('ICN5'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('ICN6'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('ICN7'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- break;
-
- case kScrollBarDlgIndex:
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('SBAR'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('HSBR'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('VSBR'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- break;
-
- case kSliderDlgIndex:
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('VSPL'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('VSPR'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('VSRC'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('HSPL'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('HSPR'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('HSRC'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- break;
-
- case kPopupMenuDlgIndex:
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('POP1'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('POP2'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('POP3'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- break;
-
- case kGroupBoxDlgIndex:
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('GRP1'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('GR1A'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('R1A1'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('R1A2'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('GR1B'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('R1B1'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('R1B2'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('GRP2'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('GR2A'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('R2A1'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('R2A2'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('GR2B'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('R2B1'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('R2B2'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('CBX1'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('GRP3'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('CBX2'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('GR3A'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('R3A1'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('R3A2'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('CBX3'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('GR3B'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('R3B1'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('R3B2'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- break;
-
- case kFolderTabsDlgIndex:
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('TAB1'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- FailNIL(aControl = (TControl*) itsWindow->FindSubView('TAB2'));
- aControl->SetEnable(enable);
- aControl->DimState(! enable, kRedraw);
-
- break;
-
- case kFocusBorderDlgIndex:
-
- FailNIL(aView = itsWindow->FindSubView('BRD1'));
- aView->SetEnable(enable);
- aView->ForceRedraw();
-
- FailNIL(aView = itsWindow->FindSubView('BRD2'));
- aView->SetEnable(enable);
- aView->ForceRedraw();
-
- FailNIL(aView = itsWindow->FindSubView('BRD3'));
- aView->SetEnable(enable);
- aView->ForceRedraw();
-
- FailNIL(aView = itsWindow->FindSubView('TVW1'));
- aView->SetEnable(enable);
- aView->ForceRedraw();
-
- FailNIL(aView = itsWindow->FindSubView('TVW2'));
- aView->SetEnable(enable);
- aView->ForceRedraw();
-
- FailNIL(aView = itsWindow->FindSubView('TVW3'));
- aView->SetEnable(enable);
- aView->ForceRedraw();
-
- break;
-
- }
- }
-
- void TMyApplication::DoAboutBox()
- {
- TWindow* aWindow;
- TStaticText* copyrightString;
-
- FailNIL(aWindow = gViewServer->NewTemplateWindow(kAboutBoxViewID, NULL));
-
- FailNIL(copyrightString = (TStaticText*) aWindow->FindSubView('COPY'));
- copyrightString->SetText(gGrayCouncilCopyright, kDontRedraw);
-
- (void) aWindow->PoseModally();
-
- aWindow->CloseAndFree();
- }
-